<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>EOC监控系统</title>
<!--#include file="lib/plugins.asp"-->
<style type="text/css">
  .ui-datepicker table {
    border: 0;
  }
  #col3{
    font-size:14px;
  }
  #chartdiv{
    //width:500px;
    height:300px;
    //float:right;
    margin:0 20px 0 0;
  }
  thead th{
    text-align:center;
    background:#e0e0e0;
  }
  tbody th,tbody td{
    text-align:center;
  }
  #tb_poll .fail{
    background:#FF9966;
  }
  #tb_poll .warn{
    background:#FFff99;
  }
  #loding{
    display:none;
  }
</style>
<!--#include file="lib/js-google-analytics.asp"-->
</head>

<body>
<!--#include file="lib/header.asp"-->
<!--#include file="lib/nav.asp"-->
<%if CheckLan() or session("bWan") then%>
<script type="text/javascript" src="lib/js-timers-1.2.js"></script>
<script type="text/javascript">
  $(function() {
    $.ajaxSetup ({
      cache: false, //关闭AJAX相应的缓存
      beforeSend:function() {
        $("#loading").show();
      },
      complete:function() {
        $("#loading").hide();
      }
    });
    $("#showoption").change(function(){
      var showdata;
      var showoption=$(this).val();
      if(showoption==0||showoption==1){
        showdata=filterdata(jsonnds,showoption);
      }else{
        showdata=jsonnds;
      }
      
      showpoll(showdata);
    });
    function filterdata(nds,option){
      var d=new Array();
      for(var i=0;i<nds.length;i++){
        if(nds[i][6]==option){
          d.push(nds[i]);
        }
      }
      return d;
    }
    
    function showpoll(nds){
      var con_poll="";
      $.each(nds,function(i,item){
      
        if(item[7]==0&&item[8]==0){
          con_poll+="<tr class='fail'>";
        }else if(item[7]==0||item[8]==0){
          con_poll+="<tr class='warn'>";
        }else{
          con_poll+="<tr class='ok'>";
        }
        con_poll+="<th class='sub' scope='row'>"+(i+1)+"</th>";
        con_poll+="<td><a class='res' href='#' rel='ndinfo.asp?ndip="+item[0]+"'>"+item[0]+"</a></td>";
        con_poll+="<td>"+item[1]+"</td>";
        con_poll+="<td>"+item[2]+"</td>";
        con_poll+="<td>"+item[3]+"</td>";
        con_poll+="<td>"+item[4]+"</td>";
        con_poll+="<td>"+item[5]+"</td>";
        con_poll+="<td></td>";
        con_poll+="</tr>";
      
      });
      //console.log(con_poll);
      $("#tb_poll tbody").html(con_poll);
        $(".res").cluetip({
          //sticky: true,
          //cluetipClass: 'rounded',
          showTitle: false,
          clickThrough: false,
          onShow: function(ct, c){
            $("#cluetip").css({"width":"auto","max-width":"400px"});
          }
        });
    }
    
    function poll(){
      $.getJSON("ndpoll.asp",function(data){
        if(data){
          json=data;
          jsonnds=data["aaData"];
          //$("#tb_poll").find("tbody").html();
          var showdata;
            //console.log(data["aaData"].length);
          var showoption=$("#showoption").val();
          if(showoption==0||showoption==1){
            showdata=filterdata(jsonnds,showoption);
          }else{
            showdata=jsonnds;
          }
          
          showpoll(showdata);
          
          
        }
      });
    }
    var json,jsonnds;
    poll();
    $("body").everyTime("1das","A",function(){
      poll();
    });
  });
</script>	
<%
Set fs = server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists(Server.MapPath("config.txt")) then
  Set f = fs.opentextfile(Server.MapPath("config.txt"))
  config=f.readall
  Set f = nothing
end if
Set fs = nothing
Test_Poll_Time=10
%>
<div id="main">
<!--#include file="lib/col1.asp"-->
<!--#include file="lib/col2.asp"-->
  <div id="col3" role="main">
    <div id="col3_content" class="clearfix">
      <div id="toolbar">
        <input id="Test_Poll_Time" name="Test_Poll_Time" type="hidden" value="<%=Test_Poll_Time%>" />
        <select id="showoption">
          <option value="0">只显示离线ND</option>
          <option value="1">只显示在线ND</option>
          <option value="2">显示全部ND</option>
        </select>
        <img id="loading" src='images/ui-anim_basic_16x16.gif' />
      </div>
      <table id="tb_poll" class="full">
        <thead>
          <tr>
            <th></th>
            <th>IP Address</th>
            <th>Last Poll Time</th>
            <th>ICMP Count</th>
            <th>ICMP Change Time</th>
            <th>Telnet Count</th>
            <th>Telnet Change Time</th>
            <th>SNMP Status</th>
          </tr>
        </thead>
        <tbody></tbody>
      </table>
    </div>
  </div>
</div>
<%else%>
<!--#include file="wan.asp"-->
<%end if%>
<!--#include file="lib/footer.asp"-->
</body>
</html>
<!--#include file="lib/connclose.asp"-->